package 设计链表;

import java.util.LinkedList;

public class MyLinkedList {
    LinkedList<Integer> linkedList;

    public MyLinkedList() {
           linkedList=new LinkedList();
    }
    
    public int get(int index) {
        return (int) linkedList.get(index);
    }
    
    public void addAtHead(int val) {
       linkedList.addFirst(val);
    }
    
    public void addAtTail(int val) {
        linkedList.addLast(val);
    }
    
    public void addAtIndex(int index, int val) {
        linkedList.add(index,val);

    }
    
    public void deleteAtIndex(int index) {
        linkedList.remove(index);

    }
}